﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="WebHoiChoMuaBan.Controllers.Helpers" %>
<%@ Import Namespace="WebHoiChoMuaBan.Controllers" %>
<%@ Import Namespace="WebHoiChoMuaBan.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    ViewGroup
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        ViewGroup</h2>
    <%WebHoiChoMuaBan.Models.Group group = (WebHoiChoMuaBan.Models.Group)ViewData["Group"];
      List<Member> lstMember = (List<Member>)ViewData["lstMember"];
      List<Member> lstAdminMember = (List<Member>)ViewData["lstAdminMember"];
        
    %>
    <div class="left">
    <form action="<%=Url.Action("updateGroup","AdminManagement") %>" method="post">
    <input type="hidden" value="<%=group.GroupID %>" name="grpID" />
        tên nhóm:
        <input type="text" value="<%=group.GroupName %>" name="Name" />
        <br />
        Mô tả:
        <input type="text" value="<%=group.Description %>" name="Decs"/>
        <br />
        <input type="button" id="buttonAddMember" value="Thêm admin" />
          <a href="<%=Url.Action("RightManager","AdminManagement",new{grpId = group.GroupID}) %>">
                                Phân quyền</a>
                            <button type="submit" value="Cập nhập">Cập nhập</button>
        <br />
        </form>
        <div id="addMemberArea">
            <table>
                <tr>
                    <th>
                        UserName
                    </th>
                    <th>
                    </th>
                    <%foreach (Member m in lstAdminMember)
                      {
                      
                    %>
                    <tr>
                        <td>
                            <%=m.MemUsername %>
                        </td>
                        <td>
                            <a href="<%=Url.Action("AddMember","AdminManagement",new{memberId = m.MemId,grpId = group.GroupID}) %>">
                                Thêm</a>
                               
                        </td>
                    </tr>
                    <%
                        } %>
                </tr>
            </table>
        </div>
    </div>
    <div class="right">
        <table>
            <tr>
                <th>
                    userName:
                </th>
                <th>
                </th>
            </tr>
            <%
                foreach (Member m in lstMember)
                {
            %>
            <tr>
                <td>
                    <%=m.MemUsername %>
                </td>
                <td>
                    <a href="<%=Url.Action("removeMember","AdminManagement",new {memberId = m.MemId,grpId  = group.GroupID}) %>">
                        Gỡ</a>
                </td>
            </tr>
            <%
                }
            %>
        </table>
    </div>
    <div class="clr">
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadHolder" runat="server">
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#addMemberArea").hide();
        });
        $(document).ready(function () {
            $("#buttonAddMember").click(function () {
                $("#addMemberArea").toggle();
            });
        });
    </script>
</asp:Content>
